/*-----------------------------------------------------------
 *version: mydesktop 3.0
 *author: muzilei
 *email: 530624206@qq.com
 *blog: http://www.muzilei.com/
 *date:2013-1-24
 *桌面初始化脚本
 ----------------------------------------------------------*/
$(window).load(function(){
	      //停止进度条
		  myDesktop.stopProgress();
		   
 		   //桌面应用json数据 	  
		   var iconData={
			   "desktop1":[{
					   'iconSrc':'desktop/icon/icon0.png',
					   'windowsId':'kuwoMusic1',
					   'windowTitle':'通知公告',
					   'iframSrc':'app/tongzhi.html',
					   'windowWidth':800,
					   'windowHeight':500,
					   'txNum':8
 						},
						{
					   'iconSrc':'desktop/icon/icon1.png', 	
					   'windowsId':'hudong1', 
					   'windowTitle':'合同协议',
					   'iframSrc':'http://lab.hudong.com/webqq/index.html',
					   'windowWidth':600,
					   'windowHeight':600,
					   'txNum':0
						},
						{
						'iconSrc':'desktop/icon/icon2.png', 	
					   'windowsId':'dubianFim1', 		
					   'windowTitle':'贷后管理',
					   'iframSrc':'http://douban.fm/partner/qq_plus',
					   'windowWidth':400,
					   'windowHeight':400,
					   'txNum':0 
						},{
					   'iconSrc':'desktop/icon/icon3.png',  	   
					   'windowsId':'kuwoMusic',   
					   'windowTitle':'待办流程',
					   'iframSrc':'http://mbox.kuwo.cn/',
					   'windowWidth':500,
					   'windowHeight':500,
					   'txNum':0 
 						},
						{
					   'iconSrc':'desktop/icon/icon4.png', 	
					   'windowsId':'hudong', 
					   'windowTitle':'资金指引',
					   'iframSrc':'http://lab.hudong.com/webqq/index.html',
					   'windowWidth':600,
					   'windowHeight':600,
					   'txNum':0 
						},
						{
						'iconSrc':'desktop/icon/icon5.png', 	
					   'windowsId':'dubianFim', 		
					   'windowTitle':'论坛',
					   'iframSrc':'http://douban.fm/partner/qq_plus',
					   'windowWidth':400,
					   'windowHeight':400,
					   'txNum':0 
						},
						{
						'iconSrc':'desktop/icon/icon6.png', 	
					   'windowsId':'Pixl12r', 	
					   'windowTitle':'我的流程',
					   'iframSrc':'http://pixlr.com/editor/?loc=zh-cn',
					   'windowWidth':600,
					   'windowHeight':600,
					   'txNum':0 
						},
						{
						'iconSrc':'desktop/icon/icon7.png', 	
					   'windowsId':'qidian12', 	
					   'windowTitle':'人事考勤',
					   'iframSrc':'http://webqq.qidian.com',
					   'windowWidth':600,
					   'windowHeight':450,
					   'txNum':0
						},
						{
					   'iconSrc':'desktop/icon/icon8.png', 	
					   'windowsId':'hudong231', 
					   'windowTitle':'日程安排',
					   'iframSrc':'http://lab.hudong.com/webqq/index.html',
					   'windowWidth':600,
					   'windowHeight':600,
					   'txNum':0 
						},
						{
						'iconSrc':'desktop/icon/icon9.png', 	
					   'windowsId':'dubianFim1ds', 		
					   'windowTitle':'发起流程',
					   'iframSrc':'http://douban.fm/partner/qq_plus',
					   'windowWidth':400,
					   'windowHeight':400,
					   'txNum':0 
						},
						{
						'iconSrc':'desktop/icon/icon10.png', 	
					   'windowsId':'Pixlr1', 	
					   'windowTitle':'查询中心',
					   'iframSrc':'http://pixlr.com/editor/?loc=zh-cn',
					   'windowWidth':600,
					   'windowHeight':600,
					   'txNum':0 
						},
						{
						'iconSrc':'desktop/icon/icon11.png', 	
					   'windowsId':'qidian1', 	
					   'windowTitle':'文件柜',
					   'iframSrc':'http://webqq.qidian.com',
					   'windowWidth':600,
					   'windowHeight':450,
					   'txNum':0
						},
						{
					   'iconSrc':'desktop/icon/icon12.png', 	
					   'windowsId':'hudong2', 
					   'windowTitle':'工作总结',
					   'iframSrc':'http://lab.hudong.com/webqq/index.html',
					   'windowWidth':600,
					   'windowHeight':600,
					   'txNum':0 
						} ,
						{
						'iconSrc':'desktop/icon/icon13.png', 	
					   'windowsId':'Pixlr2', 	
					   'windowTitle':'内部邮件',
					   'iframSrc':'http://pixlr.com/editor/?loc=zh-cn',
					   'windowWidth':600,
					   'windowHeight':600,
					   'txNum':26
					   	 },
						{
					   'iconSrc':'desktop/app_tools/bianqian/memo.png', 	
					   'windowsId':'memo', 	
					   'windowTitle':'便签',
					   'iframSrc':'desktop/app_tools/bianqian/index.html',
					   'windowWidth':162,
					   'windowHeight':200,
					   'top':0,
					   'left':'auto',
					   'right':210,
					   'isWidget':true,
					   'txNum':0
						},
						{
					   'iconSrc':'desktop/app_tools/shizhong/shizhong.png', 	
					   'windowsId':'shizhong', 	
					   'windowTitle':'时钟',
					   'iframSrc':'desktop/app_tools/shizhong/index.html',
					   'windowWidth':160,
					   'windowHeight':210,
					   'top':0,
					   'left':'auto',
					   'right':30,
					   'isWidget':true,
					   'txNum':0
						},
						{
					   'iconSrc':'desktop/app_tools/weather/weather.png', 	
					   'windowsId':'weather', 	
					   'windowTitle':'天气预报',
					   'iframSrc':'desktop/app_tools/weather/index.html',
					   'windowWidth':200,
					   'windowHeight':320,
					   'top':220,
					   'left':'auto',
					   'right':20,
					   'isWidget':true,
					   'txNum':0
						}] 
			   };
 		    
 		   
		   //禁止选择文本内容
		   myDesktop.disableSelect();					   
		   
		   //初始化桌面背景
		   myDesktop.wallpaper.init("desktop/theme/default/images/wallpaper.jpg",1);
  		   
		   //初始化桌面
		   myDesktop.desktop.init(iconData,{
				arrangeType:2,  
				iconMarginLeft:80,
				iconMarginTop:60
				});
		   
		   //初始化任务栏
		   myDesktop.taskBar.init();
		   
		   //初始化顶部栏
		   myDesktop.topBar.init();
  		   
 		//初始化桌面右键菜单
		var data=[
					[{
					text:"显示桌面",
					func:function(){
						$("div.myWindow").not(".hideWin")
						.each(function(){
								$(this).find(".winMinBtn").trigger("click");									   
 								});
						}
						}]
					,[{
					text:"系统设置",
					func:function(){}
					  },{
					text:"主题设置",
					func:function(){
  					
					myDesktop.myWindow.init({
					   'iconSrc':'desktop/theme/default/images/skin.png',  	   
					   'windowsId':'skins',   
					   'windowTitle':'主题设置',
					   'iframSrc':'app_tools/skins/index.html',
					   'windowWidth':500,
					   'windowHeight':380,
					   'parentPanel':".currDesktop"
 						});
						
					//添加到状态栏
					if(!$("#taskTab_skins").size()){
						myDesktop.taskBar.addTask("skins","主题设置","desktop/theme/default/images/skin.png");
						}}
					}]
					,[{
					  text:"退出系统",
					  func:function(){} 
					  }]
					,[{
					  text:"关于muzilei",
					  func:function(){
						  location.href="http://www.muzilei.com/";
						  } 
					  }]
					,[{
					  text:"刷新",
					  func:function(){
						  // location.href="mydesktop.jsp";
						  window.location.reload();
						  } 
					  }]					  
					];
		 myDesktop.contextMenu($(document.body),data,"body",10);

     //初始化时钟、天气预报、标签 	 
	 $("#shizhong,#weather,#memo").trigger("click");
		 
});